j3deditor.bin.hierarchy
Class J3DeTexture

java.lang.Object
  extended by j3deditor.bin.hierarchy.HierarchyNode
      extended by j3deditor.bin.hierarchy.J3DeTexture
All Implemented Interfaces:
Deletable

public class J3DeTexture
extends HierarchyNode
implements Deletable

Contains and manages an instance of javax.media.j3d.Texture.

Author:
Risto Seene
See Also:
Texture

Field Summary
static int TEXTURE_2D
          Specifies that this is 2D texture.
static int TEXTURE_3D
          Specifies that this is 3D texture.
 
Constructor Summary
J3DeTexture(javax.media.j3d.Appearance appearance)
          Creates an instance of J3DeTexture with the Texture object from the given Appearance object.
 
Method Summary
static javax.media.j3d.Texture createTexture(int type, java.awt.Image[] images, int mipMapMode, int format)
          Creates new texture using the specified properties.
 void delete()
          Removes this texture from the Appearance object.
 float getAnisotropicFilterDegree()
          Returns the anisotropic filter degree of this texture.
 int getAnisotropicFilterMode()
          Returns the anisotropic filter mode of this texture.
static java.lang.String[] getAnisotropicFilterModes()
          Returns the list of the anisotropic filter mode names.
 int getBaseLevel()
          Returns the base level of this texture.
 java.awt.Color getBoundaryColor()
          Returns the boundary color of this texture.
static java.lang.String[] getBoundaryModes()
          Returns the list of boundary mode names.
 int getBoundaryModeS()
          Returns the boundary mode for the S coordinate.
 int getBoundaryModeT()
          Returns the boundary mode for the T coordinate.
 int getBoundaryWidth()
          Returns the boundary width of this texture.
 float[] getFilter4Func()
          Returns the filter 4 function of this texture.
 int getFormat()
          Returns the format of this texture.
static java.lang.String[] getFormats()
          Returns the list of texture format names.
 java.awt.Image getImage(int level)
          Returns an image from the specified level.
 J3DeImageComponent getImageComponent(int index)
          Returns an ImageComponent from the specified index.
 float[] getLodOffset()
          Returns the lod offset of this texture.
 int getMagFilter()
          Returns the type of magnification filter.
static java.lang.String[] getMagFilters()
          Returns the list of magnification filter names.
 int getMaximumLevel()
          Returns the maximum level of this texture.
 float getMaximumLOD()
          Returns the maximum lod of this texture.
 int getMinFilter()
          Returns the minification filter of this texture.
static java.lang.String[] getMinFilters()
          Returns the list of the minification filters.
 float getMinimumLOD()
          Returns the minimum lod of this texture.
 int getMipMapMode()
          Returns the mipmap mode of this texture.
static java.lang.String[] getMipMapModes()
          Returns the list of mipmap mode names.
 float[][] getSharpenTextureFunc()
          Returns the sharpen texture function of this texture.
 J3DePoint2D getSize()
          Returns the size of this texture.
 javax.media.j3d.Texture getTexture()
          Returns the Texture contained in this J3DeTexture.
 int numberOfImageComponents()
          Returns the number of ImageComponent objects this texture contains.
 int numMipMapLevels()
          Returns the number of mipmap levels.
 void setAnisotropicFilterDegree(float degree)
          Sets the anisotropic filter degree of this texture.
 void setAnisotropicFilterMode(int mode)
          Sets the anisotropic filter mode of this texture.
 void setBaseLevel(int level)
          Sets the base level of this texture.
 void setBoundaryColor(java.awt.Color color)
          Sets the boundary color of this texture.
 void setBoundaryModeS(int mode)
          Sets the boundary mode for the S coordinate.
 void setBoundaryModeT(int mode)
          Sets the boundary mode for the T coordinate.
 void setFilter4Func(float[] weights)
          Sets the filter 4 function of this texture.
 void setLodOffset(float s, float t, float r)
          Sets the lod offset of this texture.
 void setMagFilter(int filter)
          Sets the magnification filter of this texture.
 void setMaximumLevel(int level)
          Sets the maximum level of this texture.
 void setMaximumLOD(float lod)
          Sets the maximum lod of this texture.
 void setMinFilter(int filter)
          Sets the minification filter of this texture.
 void setMinimumLOD(float lod)
          Sets the minimum lod of this texture.
 void setMipMapMode(int mode)
          Sets the mipmap mode of this texture.
 void setSharpenTextureFunc(float[] lod, float[] pts)
          Sets the sharpen texture function of this texture.
 void setTexture(javax.media.j3d.Texture texture)
          Sets the Texture of this J3DeTexture.
 
Methods inherited from class j3deditor.bin.hierarchy.HierarchyNode
clone, equals, getChild, getIndex, getIndexOfChild, getNumberOfChildren, getParent, getParent, getType, hasNamedChild, removeChild, setName, setParent, toString, updateName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TEXTURE_2D

public static final int TEXTURE_2D
Specifies that this is 2D texture.

See Also:
Constant Field Values

TEXTURE_3D

public static final int TEXTURE_3D
Specifies that this is 3D texture.

See Also:
Constant Field Values
Constructor Detail

J3DeTexture

public J3DeTexture(javax.media.j3d.Appearance appearance)
Creates an instance of J3DeTexture with the Texture object from the given Appearance object.

Parameters:
appearance - an instance of Appearance which texture component is not null
Method Detail

setTexture

public void setTexture(javax.media.j3d.Texture texture)
Sets the Texture of this J3DeTexture.

Parameters:
texture - new Texture

numberOfImageComponents

public int numberOfImageComponents()
Returns the number of ImageComponent objects this texture contains.

Returns:
the number of ImageComponent objects this texture contains

getImageComponent

public J3DeImageComponent getImageComponent(int index)
Returns an ImageComponent from the specified index.

Parameters:
index - the index of ImageComponent
Returns:
an ImageComponent from the specified index

getTexture

public javax.media.j3d.Texture getTexture()
Returns the Texture contained in this J3DeTexture.

Returns:
the Texture contained in this J3DeTexture

getImage

public java.awt.Image getImage(int level)
Returns an image from the specified level.

Parameters:
level - the index of ImageComponent which image will be returned
Returns:
an image from the specified level

getAnisotropicFilterDegree

public float getAnisotropicFilterDegree()
Returns the anisotropic filter degree of this texture.

Returns:
the anisotropic filter degree of this texture
See Also:
Texture.getAnisotropicFilterDegree()

setAnisotropicFilterDegree

public void setAnisotropicFilterDegree(float degree)
Sets the anisotropic filter degree of this texture.

Parameters:
degree - anisotropic filter degree
See Also:
Texture.setAnisotropicFilterDegree(float degree)

getAnisotropicFilterMode

public int getAnisotropicFilterMode()
Returns the anisotropic filter mode of this texture.

Returns:
the anisotropic filter mode of this texture
See Also:
Texture.getAnisotropicFilterMode()

getAnisotropicFilterModes

public static java.lang.String[] getAnisotropicFilterModes()
Returns the list of the anisotropic filter mode names.

Returns:
the list of the anisotropic filter mode names

setAnisotropicFilterMode

public void setAnisotropicFilterMode(int mode)
Sets the anisotropic filter mode of this texture.

Parameters:
mode - anisotropic filter mode.
Valid values are 0 and 1, see getAnisotropicFilterModes().
See Also:
Texture.setAnisotropicFilterMode(int mode)

getBaseLevel

public int getBaseLevel()
Returns the base level of this texture.

Returns:
the base level of this texture
See Also:
Texture.getBaseLevel()

setBaseLevel

public void setBaseLevel(int level)
Sets the base level of this texture.

Parameters:
level - base level
See Also:
Texture.setBaseLevel(int baseLevel)

getBoundaryColor

public java.awt.Color getBoundaryColor()
Returns the boundary color of this texture.

Returns:
the boundary color of this texture
See Also:
Texture.getBoundaryColor(Color4f boundaryColor)

setBoundaryColor

public void setBoundaryColor(java.awt.Color color)
Sets the boundary color of this texture.

Parameters:
color - new boundary color
See Also:
Texture.setBoundaryColor(Color4f boundaryColor)

getBoundaryModeS

public int getBoundaryModeS()
Returns the boundary mode for the S coordinate.

Returns:
the boundary mode for the S coordinate
See Also:
Texture.getBoundaryModeS()

getBoundaryModeT

public int getBoundaryModeT()
Returns the boundary mode for the T coordinate.

Returns:
the boundary mode for the T coordinate
See Also:
Texture.getBoundaryModeT()

getBoundaryModes

public static java.lang.String[] getBoundaryModes()
Returns the list of boundary mode names.

Returns:
the list of boundary mode names

setBoundaryModeS

public void setBoundaryModeS(int mode)
Sets the boundary mode for the S coordinate.

Parameters:
mode - valid values are 0, 1, 2 and 3, see getBoundaryModes().
See Also:
Texture.setBoundaryModeS(int boundaryModeS)

setBoundaryModeT

public void setBoundaryModeT(int mode)
Sets the boundary mode for the T coordinate.

Parameters:
mode - valid values are 0, 1, 2 and 3, see getBoundaryModes().
See Also:
Texture.setBoundaryModeT(int boundaryModeT)

getBoundaryWidth

public int getBoundaryWidth()
Returns the boundary width of this texture.

Returns:
the boundary width of this texture
See Also:
Texture.getBoundaryWidth()

getFilter4Func

public float[] getFilter4Func()
Returns the filter 4 function of this texture.

Returns:
the filter 4 function of this texture
See Also:
Texture.getFilter4Func(float[] weights)

setFilter4Func

public void setFilter4Func(float[] weights)
Sets the filter 4 function of this texture.

Parameters:
weights - see javax.media.j3d.Texture#setFilter4Func(float[] weights)
See Also:
Texture.setFilter4Func(float[] weights)

getFormat

public int getFormat()
Returns the format of this texture.

Returns:
the format of this texture
See Also:
Texture.getFormat()

getFormats

public static java.lang.String[] getFormats()
Returns the list of texture format names.

Returns:
the list of texture format names

getLodOffset

public float[] getLodOffset()
Returns the lod offset of this texture.

Returns:
the lod offset of this texture
See Also:
Texture.getLodOffset(Tuple3f offset)

setLodOffset

public void setLodOffset(float s,
                         float t,
                         float r)
Sets the lod offset of this texture.

Parameters:
s - see javax.media.j3d.Texture#setLodOffset(Tuple3f offset)
t - see javax.media.j3d.Texture#setLodOffset(Tuple3f offset)
r - see javax.media.j3d.Texture#setLodOffset(Tuple3f offset)
See Also:
Texture.setLodOffset(Tuple3f offset)

getMagFilter

public int getMagFilter()
Returns the type of magnification filter.

Returns:
the type of magnification filter
See Also:
Texture.getMagFilter()

getMagFilters

public static java.lang.String[] getMagFilters()
Returns the list of magnification filter names.

Returns:
the list of magnification filter names

setMagFilter

public void setMagFilter(int filter)
Sets the magnification filter of this texture.

Parameters:
filter - valid values are 0, 1, 2, 3, 4, 5, 6 and 7, see getMagFilters()
See Also:
Texture.setMagFilter(int magFilter)

getMaximumLevel

public int getMaximumLevel()
Returns the maximum level of this texture.

Returns:
the maximum level of this texture
See Also:
Texture.getMaximumLevel()

setMaximumLevel

public void setMaximumLevel(int level)
Sets the maximum level of this texture.

Parameters:
level - maximum level of texture
See Also:
Texture.setMaximumLevel(int maximumLevel)

getMaximumLOD

public float getMaximumLOD()
Returns the maximum lod of this texture.

Returns:
the maximum lod of this texture
See Also:
Texture.getMaximumLOD()

setMaximumLOD

public void setMaximumLOD(float lod)
Sets the maximum lod of this texture.

Parameters:
lod - maximum lod
See Also:
Texture.setMaximumLOD(float maximumLod)

getMinFilter

public int getMinFilter()
Returns the minification filter of this texture.

Returns:
the minification filter of this texture
See Also:
Texture.getMinFilter()

getMinFilters

public static java.lang.String[] getMinFilters()
Returns the list of the minification filters.

Returns:
the list of the minification filters

setMinFilter

public void setMinFilter(int filter)
Sets the minification filter of this texture.

Parameters:
filter - valid values are 0, 1, 2, 3, 4, 5 and 6, see getMinFilters()
See Also:
Texture.setMinFilter(int minFilter)

getMinimumLOD

public float getMinimumLOD()
Returns the minimum lod of this texture.

Returns:
the minimum lod of this texture
See Also:
Texture.getMinimumLOD()

setMinimumLOD

public void setMinimumLOD(float lod)
Sets the minimum lod of this texture.

Parameters:
lod - see javax.media.j3d.Texture#setMinimumLOD(float minimumLod)
See Also:
Texture.setMinimumLOD(float minimumLod)

getMipMapMode

public int getMipMapMode()
Returns the mipmap mode of this texture.

Returns:
the mipmap mode of this texture
See Also:
Texture.getMipMapMode()

getMipMapModes

public static java.lang.String[] getMipMapModes()
Returns the list of mipmap mode names.

Returns:
the list of mipmap mode names

setMipMapMode

public void setMipMapMode(int mode)
Sets the mipmap mode of this texture.

Parameters:
mode - valid values are 0 and 1, see getMipMapModes()
See Also:
Texture.setMipMapMode(int mipMapMode)

getSharpenTextureFunc

public float[][] getSharpenTextureFunc()
Returns the sharpen texture function of this texture.

Returns:
the sharpen texture function of this texture
See Also:
Texture.getSharpenTextureFunc(float[] lod, float[] pts)

setSharpenTextureFunc

public void setSharpenTextureFunc(float[] lod,
                                  float[] pts)
Sets the sharpen texture function of this texture.

Parameters:
lod - see javax.media.j3d.Texture#setSharpenTextureFunc(float[] lod, float[] pts)
pts - see javax.media.j3d.Texture#setSharpenTextureFunc(float[] lod, float[] pts)
See Also:
Texture.setSharpenTextureFunc(float[] lod, float[] pts)

numMipMapLevels

public int numMipMapLevels()
Returns the number of mipmap levels.

Returns:
the number of mipmap levels
See Also:
Texture.numMipMapLevels()

getSize

public J3DePoint2D getSize()
Returns the size of this texture.

Returns:
the size of this texture
See Also:
Texture.getWidth(), Texture.getHeight()

createTexture

public static javax.media.j3d.Texture createTexture(int type,
                                                    java.awt.Image[] images,
                                                    int mipMapMode,
                                                    int format)
Creates new texture using the specified properties.

Parameters:
type - either TEXTURE_2D or TEXTURE_3D
images - texture images (in 2D texture only first image is used)
mipMapMode - either Texture.BASE_LEVEL or Texture.MULTI_LEVEL_MIPMAP
format - 0 - INTENSITY
1 - LUMINANCE
2 - ALPHA
3 - LUMINACE_ALPHA
4 - RGB
5 - RGBA
Returns:
the newly created texture

delete

public void delete()
Removes this texture from the Appearance object.

Specified by:
delete in interface Deletable